﻿using UnityEngine;
using System.Collections;

public class Cannon : MonoBehaviour {

	public Transform player;
	
	public bool work = false;

	private float speed = 2f;
	

	
	void Update () {
		
		transform.parent.Translate(transform.forward * speed);
		Quaternion rot = transform.localRotation;
		transform.LookAt(player);
		//Quaternion newRot = Quaternion.Euler(0f, transform.rotation.eulerAngles.y, 0f);
		//transform.parent.rotation = Quaternion.Slerp (transform.parent.rotation, newRot, 5f * Time.deltaTime);
		//transform.rotation = rot;
		
		
		if(!work) return;

	}
}
